package com.huawei.M01.iterator;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

public class DisappearedNumber {
    public List<Integer> findDisappearedNumber(int[] nums) {

        List<Integer> result = new ArrayList<>();
        Set<Integer> helpSet = new HashSet<>();
        for (int num : nums) {
            helpSet.add(num);
        }
        for (int i = 1; i <= nums.length; i++) {
            if (!helpSet.contains(i)) {
                result.add(i);
            }
        }
        return result;
    }

    public static void main(String[] args) {
        DisappearedNumber disappearedNumber = new DisappearedNumber();
        int[] nums = new int[]{4,3,2,7,8,2,3,1};
        System.out.println(disappearedNumber.findDisappearedNumber(nums));
    }
}
